from wxauto import *

def main():
    wx=WeChat()
    # 获取当前窗口所有聊天记录
    msgs = wx.GetAllMessage()

    for msg in msgs:
        print(f"类型:{msg.type}, 发送者:{msg.sender}, 内容:{msg.content}")

if __name__ == "__main__":
    main()

# 获取好友信息
# friends = wx.GetAllFriends()
# for friend in friends:
#     print(f"备注: {friend['remark']}, 好友昵称: {friend['nickname']}, 标签: {friend['tags']}")

# # 获取当前窗口所有聊天记录
# msgs = wx.GetAllMessage()
#
# for msg in msgs:
#     print(f"类型:{msg.type}, 发送者:{msg.sender}, 内容:{msg.content}")

# # 给文件传输助手发送消息
# wx.SendMsg('这是通过wxauto发给你的消息！', '文件传输助手')

# sessions = wx.GetSessionList()
#
# for session in sessions:
#     print(session)

# 获取当前列表的会话
# sessions = wx.GetSession()
# for session in sessions:
#     if session.name in auto_reply_volleyball_sessions:
#         print(f"聊天对象名称: {session.name}")
#         print(f"最后一条消息时间: {session.time}")
#         print(f"最后一条消息内容: {session.content}")
#         print(f"是否有新消息: {session.isnew}", end='\n\n')
#         if session.content.find("#接龙")!=-1:
#             wx.SendMsg(f'{session.content}', session.name)